package com.film.admincontroller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.domain.User;
import com.film.service.UserService;
import com.film.service.impl.UserServiceImpl;

@WebServlet("/UserTypePage.do")
public class UserTypePage extends HttpServlet {
	private UserService us = new UserServiceImpl();
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session =request.getSession();
		String pageNum=request.getParameter("page");
		System.out.println(pageNum);
		List <User> userreviews=us.selectlimit(Integer.parseInt(pageNum));
		List <User> userreview=us.selectALl();
		session.setAttribute("userreviews", userreviews);
		session.setAttribute("userreview", userreview);
		session.setAttribute("userreviewsSize", userreviews.size());
		session.setAttribute("userreviewSize", userreview.size());
		response.sendRedirect("admin_jsp/userShow.jsp?flag="+pageNum);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
